<template>
    <view class="content">
        <button @click="onclicked">点击跳转到新页面</button>
        <button type="default" @click="onclicked1">使用events传递事件参数</button>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                title: 'Hello'
            }
        },
        onLoad() {

        },
        methods: {
            onclicked() {
                uni.navigateTo( {
                    url: "../index2/index2?id=1&name=张三"
                } )
            },
            onclicked1() {
                uni.navigateTo( {
                    url: "../index3/index3",
                    events: {
                        page_index_receive( data ) {
                            console.log( "index.vue 收到的data(由index3.vue发过来的): ", data );
                        }
                    },
                    success( res ) {
                        res.eventChannel.emit( 'page_index3_receive', {
                            id: 2,
                            name: "李四"
                        } );
                    }
                } )
            }
        }
    }
</script>

<style>

</style>
